<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
    <%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>离职管理</title>
<link href="<c:url value='/insdep/reset.min.css' />" rel="stylesheet" type="text/css">
<link href="<c:url value='/insdep/easyui_full.css'/>" rel="stylesheet" type="text/css">
<link href="<c:url value='/insdep/icon.css'/>" rel="stylesheet" type="text/css">
<script type="text/javascript" src="<c:url value='/insdep/jquery-1.11.3.min.js'/>"></script>
<script type="text/javascript" src="<c:url value='/insdep/jquery.easyui-1.5.2.min.js'/>"></script>
<script type="text/javascript" src="<c:url value='/insdep/insdep-extend.min.js'/>"></script>

</head>
<body>
<script type="text/javascript">

function note_bianji(val,row,index){
	var flowChart="";
	var details="";
	flowChart='<a class="easyui-linkbutton button-teal iconfont icon-friend" style="color:white;padding-left:5%;font-size:14px;padding-right:5%;margin-right:5%" onclick="flowChart('+row.quitId+')">办理人</a>';
	details='<a class="easyui-linkbutton button-blue iconfont icon-gongwenchaxun" style="color:white;padding-left:5%;font-size:14px;;padding-right:5%;margin-right:5%" onclick="details('+row.quitId+')">归档详情</a>';
	return flowChart+details;
}
$(function(){
	//按条件查询用户
	 $("#queryer").linkbutton({onClick:function(){ 
		 $('#quit_from').form('submit', {   
			 	onSubmit: function(param){  
			 		param.page = '1';    
			        param.rows = '5';
			    }  ,
			    success:function(data){    //表单查询数据刷新DataGrid
			    	var resultData = $.parseJSON(data);  
			    	$('#quit_table').datagrid('loadData', resultData); 
			    }    
			}); 
	 }});
	
	 $("#reset_Lz").linkbutton({
			onClick : function() {
				$("#quit_from").form('reset');
			}
		})
		
	$("#quit_table").datagrid({onBeforeLoad:function(parm){
		parm.empName=$("#empName").val();
		parm.deptName=$("#deptName").val();
	}})
	 
})
</script>
<script type="text/javascript">
function flowChart(quitId) {
	$("#win-all-handler-layout-center-dg").datagrid({
		 url:'getFinishedQuitAssignee?quitId='+quitId,
		 width:'100%',
		 height:'100%',
		 columns:[[
			 {field:'taskName',title:'任务名称',align:'center',width:'100'},
			 {field:'taskState',title:'任务状态',align:'center',width:'100'},
			 {field:'startTime',title:'开始时间',align:'center',width:'150'},
			 {field:'endTime',title:'结束时间',align:'center',width:'150'},
			 {field:'assignee',title:'办理人',align:'center',width:'100'}
		 ]]
	})
	$("#win-all-handler").window("open");
}
</script>
<script type="text/javascript">
function details(quitId) {
	$("#see-my-info").window({
		onBeforeClose:function(){
			$("#see-my-info-layout-center").panel("clear");
		}
	})
	$("#see-my-info").window("open")
	//给窗口填充内容
		$("#see-my-info-layout-center").panel({href : 'to_quitForm',
			onLoad : function() {
				$.post("findProcess", {
					processName : "人员离职流程",
					processId : quitId
				}, function(info) {
					info.quitUptime = new Date(info.quitUptime).toLocaleDateString();
					info.quitTime = new Date(info.quitTime).toLocaleDateString();
					$("#quitForm").form("clear");
					$("#quitForm").form("load", info);
				});
				//通过任务id去判断当前的批注填写方式，AJAX
				if (taskId != "") {
					$('#quit_dept_boss_comment').textbox('readonly',true);
					$('#quit_zong_boss_comment').textbox('readonly',true);
					$('#quit_personnel_comment').textbox('readonly',true);
					//装载已经有的批注
					$.post("getAllComments", {processName : "人员离职流程",processId : quitId},function(comments){
						$("#comments_form").form("load", comments);
					});
				}else {
					$("#comments_form").hide();
				}
			}
		});

}

</script>

<div class="easyui-layout theme-layout" data-options="fit:true">
    <div class="theme-header-layout" style="height:70px;border: 0px solid red" data-options="region:'north'">
    	<div style="margin-left: 3%;width:80%;margin-right:5%;margin-top:20px;border: 0px solid green">
        <form action="pageQuit" id="quit_from" class="searcher-form" method="post">
    		<input id="empName" name="empName" class="easyui-textbox"  style="width: 30%;"  labelAlign="right" label="姓名：" labelWidth="150px"> 
			<input id="deptName" name="deptName" class="easyui-textbox"  style="width: 30%;"  labelAlign="right" label="部门：" labelWidth="150px"> 
			<a id="queryer"  class="easyui-linkbutton button-line-blue" 
			style="width: 9%;height: 30px;margin-left: 9%;"><i class="iconfont icon-roundcheck"></i>查询</a>
			<a id="reset_Lz"  class="easyui-linkbutton button-line-blue return" 
			style="width: 9%;height: 30px;margin-left: 9%;"><i class="iconfont icon-refresh"></i>重置</a>
    	</form>
    	</div>
    </div>
    <div class="theme-center-layout" style="border: 0px solid red" data-options="region:'center',title:'离职人员信息表'">
        <!-- <div style="margin-left: 12%;margin-right:5%;margin-top:20px;border: 0px solid red"> -->
        <!--  class="table table-striped" -->
        <table id=quit_table style="width:100%;height: 100%" class="easyui-datagrid" 
		data-options="
		height:450,
		fitColumns:true,
		url:'pageQuit',
		rownumbers: true,
		<!-- toolbar: '#tb', -->
		nowrap:false, 
		autoRowHeight:true,
		pagination:true,
		pageSize: 5,
		pageList:[5,10,15,20]
		">
	<thead>
		<tr>
			<th style="font-weight: bold;width: 9%" align="center" data-options="field:'deptName'">部门名称</th>
			<th style="font-weight: bold;width: 9%" align="center" data-options="field:'empName'">姓名</th>
			<th style="font-weight: bold;width: 9%" align="center" data-options="field:'positionName'">职位</th>
			<th style="font-weight: bold;width: 11%" align="center" data-options="field:'quitUptime'">申请日期</th>
			<th style="font-weight: bold;width: 11%" align="center" data-options="field:'empEntertime'">入职日期</th>
			<th style="font-weight: bold;width: 11%" align="center" data-options="field:'empPositivetime'">转正日期</th>
			<th style="font-weight: bold;width: 20%" align="center" data-options="field:'quitExplain'">离职原因</th>
			
			
			<th field="note" style="font-weight: bold;width: 20%;" align="center" data-options="formatter:note_bianji">操作</th>
		</tr>
	</thead>
</table>
<!-- </div> -->

    </div>

</div>
<div id="see-my-info" class="easyui-window" title="流程表单"
			data-options="collapsible:false,minimizable:false,maximizable:false,modal:true,iconCls:'icon-form',closed:true"
			style="width: 60%; height: 90%; padding: 5px">
			<div id="see-my-info-layout" class="easyui-layout" data-options="fit:true">
				<div id="see-my-info-layout-center" data-options="region:'center'"
					align="center" style="padding: 10px;"></div>
				<div data-options="region:'south',border:false"
					style="text-align: right; padding: 5px 0 0;">
					<a class="easyui-linkbutton"
						data-options="iconCls:'icon-cancel', plain:true" href="javascript:void(0)"
						onclick="$('#see-my-info').window('close');">取消</a>
				</div>
			</div>
		</div>

<div id="win-all-handler" class="easyui-window" title="流程执行者"
			data-options="collapsible:false,minimizable:false,maximizable:false,modal:true,iconCls:'icon-form',closed:true"
			style="width: 50%; height: 70%; padding: 5px">
			<div id="win-all-handler-layout" class="easyui-layout" data-options="fit:true">
				<div id="win-all-handler-layout-center" data-options="region:'center'"
					align="center" style="padding: 10px;">
					<div id="win-all-handler-layout-center-dg"></div>	
				</div>
				<div data-options="region:'south',border:false"
					style="text-align: right; padding: 5px 0 0;">
					<a class="easyui-linkbutton"
						data-options="iconCls:'icon-cancel', plain:true" href="javascript:void(0)"
						onclick="$('#win-all-handler').window('close');">取消</a>
				</div>
			</div>
		</div>
</body>
</html>